package reflex;

import java.util.concurrent.ThreadPoolExecutor;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: homechen
 * Date: 2024-03-10
 * Time: 21:02
 */

/**
 * 通过反射获取这个类
 */
public class Reflex {
    public static void main(String[] args) {
        // 通过 getClass 获取 Class 对象
        Student student = new Student();
        Class c1 = student.getClass();

        // 通过类名.class 获取 Class 对象
        Class c2 = Student.class;

        // 通过 Class.forName() 获取Class 对象
        Class c3 = null;
        try {
            c3 = Class.forName("Student");
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }

        System.out.println(c1.equals(c2));
        System.out.println(c2.equals(c3));
    }
}
